
const { ccclass, property } = cc._decorator;


@ccclass
export default class CommonBtnCpnt extends cc.Button {
    @property({
        type: cc.Float,
        tooltip: `秒，按钮响应时间间隔`,
    })
    callInterval: number = 2

    private _callInterval: number = 0

    onLoad(): void {
        cc.log(`${cc.js.getClassName(this)} onLoad`)

        this.node.on(cc.Node.EventType.TOUCH_END, (event: cc.Event.EventTouch) => {
            cc.log(`${cc.js.getClassName(this)}`)

            if (this._callInterval > 0) {
                event.stopPropagationImmediate()
            }
        }, this, true)
    }

    update(dt: number) {
        super.update(dt)

        if (this._callInterval > 0) {
            this._callInterval -= dt
        }
    }
}
